import { Admin } from "@/api/interface/admin";
import { ResPage } from "@/api/interface/index";
import { PORT1 } from "@/api/config/servicePort";
import http from "@/api";

export const getUserListApi = (params?: { page?: number; pageSize?: number }) => {
  return http.get<ResPage<Admin.UserItem>>(PORT1 + `/admin/user/list`, params);
};
export const createUserApi = (params: Admin.CreateUserParams) => {
  return http.post(PORT1 + `/admin/user/create`, params);
};

export const updateUserApi = (params: Admin.UpdateUserParams) => {
  return http.post<boolean>(PORT1 + `/admin/user/update`, params);
};

export const deleteUserApi = (params: { FUserId: string }) => {
  return http.post<boolean>(PORT1 + `/admin/user/delete`, params);
};

export const getAllUserList = (params?: { FUsername: string }) => {
  return http.post<Admin.UserItem[]>(PORT1 + `/admin/user/listAll`, params, {
    loading: false
  });
};
